package com.pine.app.module.security.oauth.provider.client.service.impl;

import com.pine.app.module.security.oauth.provider.client.ClientDetails;
import com.pine.app.module.security.oauth.provider.client.ClientDetailsService;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: pine-security
 * @description: 内存方式加载客户端信息
 * @author: xyjxust
 * @create: 2019-09-05 22:32
 **/

public class InMemoryClientDetailsService implements ClientDetailsService {

    private Map<String, ClientDetails> clientDetailsStore = new HashMap();

    public InMemoryClientDetailsService() {

    }

    public InMemoryClientDetailsService(Map<String, ClientDetails> clientDetailsStore) {
        this.clientDetailsStore = clientDetailsStore;
    }


    @Override
    public ClientDetails loadClientDetail(String clientId) {
        return clientDetailsStore.get(clientId);
    }

    public void setClientDetailsStore(Map<String, ClientDetails> clientDetailsStore) {
        this.clientDetailsStore = clientDetailsStore;
    }
}
